package com.h.controller;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MyController {
    //RequestMapping作用1 value配置请求url
    @RequestMapping("/a")
    public void a(){
        System.out.println("aaaaa");
    }
    //RequestMapping作用1 method配置请求方式
    //默认任意请求类型都可以请求
    //优点 1.增强了方法的安全性   2.可以实现url的复用
    @RequestMapping(value = "/b",method = RequestMethod.POST)
    public void b(){
        System.out.println("bbbbb");
    }
    @RequestMapping(value = "/b",method = RequestMethod.DELETE)
    public void b1(){
        System.out.println("bbbbb");
    }
    //RequestMapping作用3 params限制请求数据\
    //限制请求时 必须携带name为username的数据
    @RequestMapping(value = "/c", params = {"username"})
    public void c(){
        System.out.println("ccccc");
    }
    //是否携带username都可以  但是username的值不能为admin
    @RequestMapping(value = "/d", params = {"username!=admin"})
    public void d(){
        System.out.println("ddddd");
    }
}